<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title></title>
<link href="$!webPath/resources/style/system/manage/$!{config.websiteCss}/template.css"  rel="stylesheet" type="text/css"/>
<link  href="$!webPath/resources/style/common/css/jquery-ui-1.8.22.custom.css" type=text/css rel=stylesheet>
<script src="$!webPath/resources/js/jquery-1.8.3.min.js"></script>
<script src="$!webPath/resources/js/jquery.validate.min.js"></script>
<script src="$!webPath/resources/js/jquery.shop.common.js"></script>
<script src="$!webPath/resources/js/jquery.shop.base.js"></script>
<script src="$!webPath/resources/js/jquery.poshytip.min.js"></script>
<script src="$!webPath/resources/js/jquery-ui-1.8.21.js"></script>
<script src="$!webPath/resources/js/jquery.zh.cn.js"></script>
<script type="text/javascript" src="$!webPath/resources/js/layer/layer.js"></script>
<script type="text/javascript" src="$!webPath/resources/js/layui/layui.js"></script>
<link rel="stylesheet" href="$!webPath/resources/js/layui/css/layui.css" media="all">
<style>
table{
width: 100%;
margin-top: 1%
}
table tr{
width: 100%
}
table tr td{
  margin-right: 10px;
  font-size: 14px;
  margin-top: 20px;
  text-align: center;
}
</style>
<script>
function editColumn(a){
	if($(a).attr("checked")){
		$("input[name='a']").attr("checked",true)
		$("input[name='b']").attr("checked",true)
	}else{
		$("input[name='a']").attr("checked",false)
		$("input[name='b']").attr("checked",false)
	}
}
function editEzs(a){
	if($(a).attr("checked")){
		$(this).attr("checked",false)
	}else{
		$(this).attr("checked",true)
	}
	var flag=false
	$("input[name='b']").each(function(){
		if(!$(this).attr("checked")){
			flag=true
		}
	})
	if(flag){
		$("input[name='a']").attr("checked",false)
	}else{
		$("input[name='a']").attr("checked",true)
	}
	
}
//生成静态网页
function saveStaticPage(){
/* 	if($("input[name='b']:checked").length!=1){
		alert("请选择一条数据")
	}else{
		window.location.href="$!webPath/admin/loadCheckEzsSubstance.htm?id="+$("input[name='b']:checked").attr("value")
	} */
}
//移动
function movePage(){
	if($("input[name='b']:checked").length!=1){
		alert("请选择一条数据")
	}else{
		window.location.href="$!webPath/admin/loadMoveEzsSubstance.htm?id="+$("input[name='b']:checked").attr("value")+"&span=1"
	}
}
//复制
function copyPage(){
	if($("input[name='b']:checked").length!=1){
		alert("请选择一条数据")
	}else{
		window.location.href="$!webPath/admin/loadMoveEzsSubstance.htm?id="+$("input[name='b']:checked").attr("value")+"&span=2"
	}
}
//审核
function signPage(){
	if($("input[name='b']:checked").length!=1){
		alert("请选择一条数据")
	}else{
		window.location.href="$!webPath/admin/loadCheckEzsSubstance.htm?id="+$("input[name='b']:checked").attr("value")
	}
}
//保存固顶
function saveTopPage(){
	if($("input[name='b']:checked").length!=1){
		alert("请选择一条数据")
	}else{
		window.location.href="$!webPath/admin/loadMoveEzsSubstance.htm?id="+$("input[name='b']:checked").attr("value")+"&span=3"
	}
}

function searchEzs(){
	var name=$("#name").attr("value")
	var userName=$("#userName").attr("value")
	var publicTime=$("#publicTime").attr("value")
	var ec=$("#ec").attr("value")
	var sUrl='$!webPath/admin/ezsSubstance_list.htm?'
	if(name!=undefined&&name!=""){
		sUrl+="name="+name+"&"
	}
	if(userName!=undefined&&userName!=""){
		sUrl+="userName="+userName+"&"
	}
	if(publicTime!=undefined&&publicTime!=""){
		sUrl+="publicTime="+publicTime+"&"
	}
	if(ec!=undefined&&ec!=""){
		sUrl+="ec="+ec
	}
	window.location.href=sUrl
}
function gotoPage(vs){
	window.location.href="$!webPath/admin/ezsSubstance_list.htm?currentPage="+vs
}
</script>
</head>
<body>
<div style="width: 100%;height: 100%">
    <div style="width: 100%;height: 5%">
    <button onclick="window.location.href='$!webPath/admin/loadAddEzsSubstance.htm'" style="width: 100px;height: 30px;border-radius:10%;margin-left: 1%;margin-top: 1%;font-weight: bold;background-color: red;color: white;">添加文档</button>
    <button onclick="window.location.href='$!webPath/admin/ezsSubstance_list.htm?userId=1'" style="width: 100px;height: 30px;border-radius:10%;margin-left: 1%;margin-top: 1%;font-weight: bold;">我的文档</button>
    <button onclick="window.location.href='$!webPath/admin/ezsSubstance_list.htm?status=1'" style="width: 100px;height: 30px;border-radius:10%;margin-left: 1%;margin-top: 1%;font-weight: bold;">待审核文档</button>
    <button onclick="window.location.href='$!webPath/admin/ezsSubstance_list.htm?status=3'" style="width: 100px;height: 30px;border-radius:10%;margin-left: 1%;margin-top: 1%;font-weight: bold;">退回文档</button>
    <button onclick="window.location.href='$!webPath/admin/loadDeleteEzsSubstance.htm'" style="width: 100px;height: 30px;border-radius:10%;margin-left: 1%;margin-top: 1%;font-weight: bold;">文档回收站</button>
    </div>
    <div style="width: 98%;height: 91%;margin-top: 2%;margin-left: 1%">
      <div>
       <span>标题：</span><span><input type="text" id="name" value="$!name"/></span><span>&nbsp;&nbsp;发布者:&nbsp;</span><span><input type="text" id="userName" value="$!userName"/></span>
       <span>&nbsp;&nbsp;发布时间：</span>
       <span>
         <select id="publicTime">
           <option value="">请选择时间</option>
           <option value="7" #if($!publicTime==7)selected="selected"#end>一周</option>
           <option value="15" #if($!publicTime==15)selected="selected"#end>半个月</option>
           <option value="30" #if($!publicTime==30)selected="selected"#end>一个月</option>
         </select>
       </span>
       <span>&nbsp;&nbsp;栏目：</span>
       <span>
         <select id="ec" name="ec">
             <option value="">请选择栏目</option>
           #foreach($ezsColumn in $ezsColumns)
             <option value="$!ezsColumn.id" #if($!ecId==$!ezsColumn.id)selected="selected"#end>$!ezsColumn.name</option>
           #end
         </select>
       </span>
       <span><button onclick="searchEzs()" style="width: 50px;height: 25px;">&nbsp;搜索</button></span>
      </div>
      <table>
        <tr>
          <td><input type="checkbox" name="a" onclick="editColumn(this)"/></td>
          <td>ID</td>
          <td>标题</td>
          <td>发布时间</td>
          <td>类目</td>
          <td>发布者</td>
          <td>点击</td>
          <td>状态</td>
          <td>静态页</td>
          <td>操作</td>
        </tr>
          #foreach($oj in $objs)
          <tr>
             <td><input type="checkbox" name="b" value="$!oj.id" onclick="editEzs(this)"/></td>
             <td>$!oj.id</td>
             <td>$!oj.name</td>
             <td>$!oj.addTime</td>
             <td>$!oj.ec.name</td>
             <td>$!oj.u.userName</td>
             <td>$!oj.clickRate</td>
             <td>#if($!oj.status==1)未审核#elseif($!oj.status==2)已审核#elseif($!oj.status==3)退回#else未知#end</td>
             <td>#if($!oj.staticStatus==1)未生成#elseif($!oj.staticStatus==2)已生成#else未知#end</td>
             <td><a onclick="window.location.href='$!webPath/admin/loadSeeEzsSubstance.htm?id=$!oj.id'">查看/</a><a onclick="window.location.href='$!webPath/admin/loadEditEzsSubstance.htm?id=$!oj.id'">修改/</a><a onclick="window.location.href='$!webPath/admin/deleteEzsSubstance.htm?id=$!oj.id'">删除</a></td>
          </tr>
          #end
      </table>
      <div>
        <button onclick="saveStaticPage()" style="width: 100px;height: 30px;border-radius:10%;margin-top: 1%;font-weight: bold;">生成静态页</button>
        <button onclick="movePage()" style="width: 100px;height: 30px;border-radius:10%;margin-left: 1%;margin-top: 1%;font-weight: bold;">移动</button>
        <button onclick="copyPage()" style="width: 100px;height: 30px;border-radius:10%;margin-left: 1%;margin-top: 1%;font-weight: bold;">复制</button>
        <button onclick="signPage()" style="width: 100px;height: 30px;border-radius:10%;margin-left: 1%;margin-top: 1%;font-weight: bold;">审核</button>
        <button onclick="saveTopPage()" style="width: 100px;height: 30px;border-radius:10%;margin-left: 1%;margin-top: 1%;font-weight: bold;">保存固顶</button>
      </div>
      <div class="fenye" align="right">
         <span id="queryCondition" style="display:none">
		   #foreach($sm in $sms)
	         <input name="$!sm.key" id="$!sm.key" type="hidden" value="$!sm.value"/>
		   #end
		 </span>
		   <input name="currentPage" type="hidden" id="currentPage" value="$!currentPage" />
	      $!gotoPageFormHTML </div>
    </div>
</div>
</body>
</html>
